package com.edol.painting.painting;

import android.content.Context;
import android.graphics.BlurMaskFilter;
import android.graphics.Canvas;
import android.graphics.Rect;

public class PenBrush extends Brush {

	private static final float PEN_BRUSH_BLUR_RADIUS = 1.0f;

	protected PenBrush(Context context) {
		super(context, BRUSH_PEN);
		mEffectType = EFFECT_TYPE_PRESSURE;
		BlurMaskFilter blurMaskFilter = new BlurMaskFilter(PEN_BRUSH_BLUR_RADIUS, BlurMaskFilter.Blur.SOLID);
        mPaint.setMaskFilter(blurMaskFilter);
	}

	@Override
	protected void drawParticle(Canvas canvas, Particle particle, Rect bounds) {
		int width = (int) (particle.width + PEN_BRUSH_BLUR_RADIUS);
		int left = (int) (particle.x - width);
		int top = (int) (particle.y - width);
		int right = (int) (particle.x + width);
		int bottom = (int) (particle.y + width);
		bounds.union(left, top, right, bottom);
		mLayerCanvas.drawCircle(particle.x, particle.y, particle.width, mPaint);
	}
}
